/////////////////////////
// 	DDComUn.cpp	:	v0010
//	Written by 	:	Li	Haijun
//	Compiler	:	Microsoft Visual C++ 4.0
//	v0010		:	1.2.1997
/////////////////////////
// to define a class of command-unit : a son class of CDDButtonUnit
/////////////////////////

#include	"stdafx.h"

#include	"DDComUn.h"

CDDCommandUnit::CDDCommandUnit()
{
	for(int i=0; i<9; i++)
	{
		m_ButtonPos[i].x = 501 + (i%3)*40;
		m_ButtonPos[i].y = 336 + (i/3)*40;
	}
	for(int j=9; j<MAX_BUTTONINUNIT; j++ )
	{
		m_ButtonPos[j].x = 0;
		m_ButtonPos[j].y = 0;
	}
}
// to blit this command unit to back buffer
void CDDCommandUnit::Blit()
{
	for( int i=0; i<MAX_BUTTONINUNIT; i++ )
	{
		if( m_pButton[i] != NULL )
		{
			int x = m_ButtonPos[i].x;
			int y = m_ButtonPos[i].y;

			m_pButton[i]->SetPosition(x, y);
			m_pButton[i]->Blit();
		}	
	}
}

// to show this command unit
void CDDCommandUnit::Show()
{
	for( int i=0; i<MAX_BUTTONINUNIT; i++ )
	{
		if( m_pButton[i] != NULL )
		{
			int x = m_ButtonPos[i].x;
			int y = m_ButtonPos[i].y;

			m_pButton[i]->SetPosition(x, y);
			m_pButton[i]->Show();
		}	
	}
}
//	END
